home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / Slots.p < prev    next >
Encoding:
Text File  |  1995-07-06  |  13.7 KB  |  432 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Slots.p
  3.  
  4.      Contains:    Slot Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT Slots;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __SLOTS__}
  30. {$SETC __SLOTS__ := 1}
  31.  
  32. {$I+}
  33. {$SETC SlotsIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$IFC UNDEFINED __EVENTS__}
  43. {$I Events.p}
  44. {$ENDC}
  45. {    Quickdraw.p                                                    }
  46. {        MixedMode.p                                                }
  47. {        QuickdrawText.p                                            }
  48. {    OSUtils.p                                                    }
  49. {        Memory.p                                                }
  50.  
  51. {$IFC UNDEFINED __OSUTILS__}
  52. {$I OSUtils.p}
  53. {$ENDC}
  54.  
  55. {$IFC UNDEFINED __FILES__}
  56. {$I Files.p}
  57. {$ENDC}
  58. {    Finder.p                                                    }
  59.  
  60. {$PUSH}
  61. {$ALIGN MAC68K}
  62. {$LibExport+}
  63.  
  64. CONST
  65.     fCardIsChanged                = 1;                            {Card is Changed field in StatusFlags field of sInfoArray}
  66.     fCkForSame                    = 0;                            {For SearchSRT. Flag to check for SAME sResource in the table. }
  67.     fCkForNext                    = 1;                            {For SearchSRT. Flag to check for NEXT sResource in the table. }
  68.     fWarmStart                    = 2;                            {If this bit is set then warm start else cold start.}
  69.  
  70.     stateNil                    = 0;                            {State}
  71.     stateSDMInit                = 1;                            {:Slot declaration manager Init}
  72.     statePRAMInit                = 2;                            {:sPRAM record init}
  73.     statePInit                    = 3;                            {:Primary init}
  74.     stateSInit                    = 4;                            {:Secondary init}
  75. { flags for spParamData }
  76.     fall                        = 0;                            { bit 0: set=search enabled/disabled sRsrc's }
  77.     foneslot                    = 1;                            {    1: set=search sRsrc's in given slot only }
  78.     fnext                        = 2;                            {    2: set=search for next sRsrc }
  79. { Misc masks }
  80.     catMask                        = $08;                            { sets spCategory field of spTBMask (bit 3) }
  81.     cTypeMask                    = $04;                            { sets spCType    field of spTBMask (bit 2) }
  82.     drvrSWMask                    = $02;                            { sets spDrvrSW   field of spTBMask (bit 1) }
  83.     drvrHWMask                    = $01;                            { sets spDrvrHW      field of spTBMask (bit 0) }
  84.  
  85. TYPE
  86.     {
  87.         SlotIntServiceProcPtr uses register based parameters on the 68k and cannot
  88.         be written in or called from a high-level language without the help of
  89.         mixed mode or assembly glue.
  90.  
  91.         In:
  92.          => sqParameter     A1.L
  93.         Out:
  94.          <= return value    D0.W
  95.     }
  96.     SlotIntServiceProcPtr = Register68kProcPtr;  { register FUNCTION SlotIntService(sqParameter: LONGINT): INTEGER; }
  97.     SlotIntServiceUPP = UniversalProcPtr;
  98.  
  99. CONST
  100.     uppSlotIntServiceProcInfo = $0000B822; { Register FUNCTION (4 bytes in A1): 2 bytes in D0; }
  101.  
  102. FUNCTION NewSlotIntServiceProc(userRoutine: SlotIntServiceProcPtr): SlotIntServiceUPP;
  103.     {$IFC NOT GENERATINGCFM }
  104.     INLINE $2E9F;
  105.     {$ENDC}
  106.  
  107. FUNCTION CallSlotIntServiceProc(sqParameter: LONGINT; userRoutine: SlotIntServiceUPP): INTEGER;
  108.     {$IFC NOT GENERATINGCFM}
  109.     {To be implemented:  Glue to move parameters into registers.}
  110.     {$ENDC}
  111.  
  112. TYPE
  113.     SlotIntQElement = RECORD
  114.         sqLink:                    Ptr;                                    {ptr to next element}
  115.         sqType:                    INTEGER;                                {queue type ID for validity}
  116.         sqPrio:                    INTEGER;                                {priority}
  117.         sqAddr:                    SlotIntServiceUPP;                        {interrupt service routine}
  118.         sqParm:                    LONGINT;                                {optional A1 parameter}
  119.     END;
  120.  
  121.     SQElemPtr = ^SlotIntQElement;
  122.  
  123.     SpBlock = RECORD
  124.         spResult:                LONGINT;                                {FUNCTION Result}
  125.         spsPointer:                Ptr;                                    {structure pointer}
  126.         spSize:                    LONGINT;                                {size of structure}
  127.         spOffsetData:            LONGINT;                                {offset/data field used by sOffsetData}
  128.         spIOFileName:            Ptr;                                    {ptr to IOFile name for sDisDrvrName}
  129.         spsExecPBlk:            Ptr;                                    {pointer to sExec parameter block.}
  130.         spParamData:            LONGINT;                                {misc parameter data (formerly spStackPtr).}
  131.         spMisc:                    LONGINT;                                {misc field for SDM.}
  132.         spReserved:                LONGINT;                                {reserved for future expansion}
  133.         spIOReserved:            INTEGER;                                {Reserved field of Slot Resource Table}
  134.         spRefNum:                INTEGER;                                {RefNum}
  135.         spCategory:                INTEGER;                                {sType: Category}
  136.         spCType:                INTEGER;                                {Type}
  137.         spDrvrSW:                INTEGER;                                {DrvrSW}
  138.         spDrvrHW:                INTEGER;                                {DrvrHW}
  139.         spTBMask:                SInt8;                                    {type bit mask bits 0..3 mask words 0..3}
  140.         spSlot:                    SInt8;                                    {slot number}
  141.         spID:                    SInt8;                                    {structure ID}
  142.         spExtDev:                SInt8;                                    {ID of the external device}
  143.         spHwDev:                SInt8;                                    {Id of the hardware device.}
  144.         spByteLanes:            SInt8;                                    {bytelanes from card ROM format block}
  145.         spFlags:                SInt8;                                    {standard flags}
  146.         spKey:                    SInt8;                                    {Internal use only}
  147.     END;
  148.  
  149.     SpBlockPtr = ^SpBlock;
  150.  
  151.     SInfoRecord = RECORD
  152.         siDirPtr:                Ptr;                                    {Pointer to directory}
  153.         siInitStatusA:            INTEGER;                                {initialization E}
  154.         siInitStatusV:            INTEGER;                                {status returned by vendor init code}
  155.         siState:                SInt8;                                    {initialization state}
  156.         siCPUByteLanes:            SInt8;                                    {0=[d0..d7] 1=[d8..d15]}
  157.         siTopOfROM:                SInt8;                                    {Top of ROM= $FssFFFFx: x is TopOfROM}
  158.         siStatusFlags:            SInt8;                                    {bit 0 - card is changed}
  159.         siTOConst:                INTEGER;                                {Time Out C for BusErr}
  160.         siReserved:                ARRAY [0..1] OF SInt8;                    {reserved}
  161.         siROMAddr:                Ptr;                                    { addr of top of ROM }
  162.         siSlot:                    SInt8;                                    { slot number }
  163.         siPadding:                ARRAY [0..2] OF SInt8;                    { reserved }
  164.     END;
  165.  
  166.     SInfoRecPtr = ^SInfoRecord;
  167.  
  168.     SDMRecord = RECORD
  169.         sdBEVSave:                ProcPtr;                                {Save old BusErr vector}
  170.         sdBusErrProc:            ProcPtr;                                {Go here to determine if it is a BusErr}
  171.         sdErrorEntry:            ProcPtr;                                {Go here if BusErrProc finds real BusErr}
  172.         sdReserved:                LONGINT;                                {Reserved}
  173.     END;
  174.  
  175.     FHeaderRec = RECORD
  176.         fhDirOffset:            LONGINT;                                {offset to directory}
  177.         fhLength:                LONGINT;                                {length of ROM}
  178.         fhCRC:                    LONGINT;                                {CRC}
  179.         fhROMRev:                SInt8;                                    {revision of ROM}
  180.         fhFormat:                SInt8;                                    {format - 2}
  181.         fhTstPat:                LONGINT;                                {test pattern}
  182.         fhReserved:                SInt8;                                    {reserved}
  183.         fhByteLanes:            SInt8;                                    {ByteLanes}
  184.     END;
  185.  
  186.     FHeaderRecPtr = ^FHeaderRec;
  187.  
  188. { }
  189. {     Extended Format header block  -  extended declaration ROM format header for super sRsrc directories.    <H2><SM0>}
  190. { }
  191.     XFHeaderRec = RECORD
  192.         fhXSuperInit:            LONGINT;                                {Offset to SuperInit SExecBlock    <fhFormat,offset>}
  193.         fhXSDirOffset:            LONGINT;                                {Offset to SuperDirectory            <$FE,offset>}
  194.         fhXEOL:                    LONGINT;                                {Psuedo end-of-list                <$FF,nil>}
  195.         fhXSTstPat:                LONGINT;                                {TestPattern}
  196.         fhXDirOffset:            LONGINT;                                {Offset to (minimal) directory}
  197.         fhXLength:                LONGINT;                                {Length of ROM}
  198.         fhXCRC:                    LONGINT;                                {CRC}
  199.         fhXROMRev:                SInt8;                                    {Revision of ROM}
  200.         fhXFormat:                SInt8;                                    {Format-2}
  201.         fhXTstPat:                LONGINT;                                {TestPattern}
  202.         fhXReserved:            SInt8;                                    {Reserved}
  203.         fhXByteLanes:            SInt8;                                    {ByteLanes}
  204.     END;
  205.  
  206.     XFHeaderRecPtr = ^XFHeaderRec;
  207.  
  208.     SEBlock = PACKED RECORD
  209.         seSlot:                    UInt8;                                    {Slot number.}
  210.         sesRsrcId:                UInt8;                                    {sResource Id.}
  211.         seStatus:                INTEGER;                                {Status of code executed by sExec.}
  212.         seFlags:                UInt8;                                    {Flags}
  213.         seFiller0:                UInt8;                                    {Filler, must be SignedByte to align on odd boundry}
  214.         seFiller1:                UInt8;                                    {Filler}
  215.         seFiller2:                UInt8;                                    {Filler}
  216.         seResult:                LONGINT;                                {Result of sLoad.}
  217.         seIOFileName:            LONGINT;                                {Pointer to IOFile name.}
  218.         seDevice:                UInt8;                                    {Which device to read from.}
  219.         sePartition:            UInt8;                                    {The partition.}
  220.         seOSType:                UInt8;                                    {Type of OS.}
  221.         seReserved:                UInt8;                                    {Reserved field.}
  222.         seRefNum:                UInt8;                                    {RefNum of the driver.}
  223.         seNumDevices:            UInt8;                                    { Number of devices to load.}
  224.         seBootState:            UInt8;                                    {State of StartBoot code.}
  225.     END;
  226.  
  227. {  Principle  }
  228.  
  229. FUNCTION SReadByte(spBlkPtr: SpBlockPtr): OSErr;
  230.     {$IFC NOT GENERATINGCFM}
  231.     INLINE $205F, $7000, $A06E, $3E80;
  232.     {$ENDC}
  233. FUNCTION SReadWord(spBlkPtr: SpBlockPtr): OSErr;
  234.     {$IFC NOT GENERATINGCFM}
  235.     INLINE $205F, $7001, $A06E, $3E80;
  236.     {$ENDC}
  237. FUNCTION SReadLong(spBlkPtr: SpBlockPtr): OSErr;
  238.     {$IFC NOT GENERATINGCFM}
  239.     INLINE $205F, $7002, $A06E, $3E80;
  240.     {$ENDC}
  241. FUNCTION SGetCString(spBlkPtr: SpBlockPtr): OSErr;
  242.     {$IFC NOT GENERATINGCFM}
  243.     INLINE $205F, $7003, $A06E, $3E80;
  244.     {$ENDC}
  245. FUNCTION SGetBlock(spBlkPtr: SpBlockPtr): OSErr;
  246.     {$IFC NOT GENERATINGCFM}
  247.     INLINE $205F, $7005, $A06E, $3E80;
  248.     {$ENDC}
  249. FUNCTION SFindStruct(spBlkPtr: SpBlockPtr): OSErr;
  250.     {$IFC NOT GENERATINGCFM}
  251.     INLINE $205F, $7006, $A06E, $3E80;
  252.     {$ENDC}
  253. FUNCTION SReadStruct(spBlkPtr: SpBlockPtr): OSErr;
  254.     {$IFC NOT GENERATINGCFM}
  255.     INLINE $205F, $7007, $A06E, $3E80;
  256.     {$ENDC}
  257. {  Special  }
  258. FUNCTION SReadInfo(spBlkPtr: SpBlockPtr): OSErr;
  259.     {$IFC NOT GENERATINGCFM}
  260.     INLINE $205F, $7010, $A06E, $3E80;
  261.     {$ENDC}
  262. FUNCTION SReadPRAMRec(spBlkPtr: SpBlockPtr): OSErr;
  263.     {$IFC NOT GENERATINGCFM}
  264.     INLINE $205F, $7011, $A06E, $3E80;
  265.     {$ENDC}
  266. FUNCTION SPutPRAMRec(spBlkPtr: SpBlockPtr): OSErr;
  267.     {$IFC NOT GENERATINGCFM}
  268.     INLINE $205F, $7012, $A06E, $3E80;
  269.     {$ENDC}
  270. FUNCTION SReadFHeader(spBlkPtr: SpBlockPtr): OSErr;
  271.     {$IFC NOT GENERATINGCFM}
  272.     INLINE $205F, $7013, $A06E, $3E80;
  273.     {$ENDC}
  274. FUNCTION SNextSRsrc(spBlkPtr: SpBlockPtr): OSErr;
  275.     {$IFC NOT GENERATINGCFM}
  276.     INLINE $205F, $7014, $A06E, $3E80;
  277.     {$ENDC}
  278. FUNCTION SNextTypeSRsrc(spBlkPtr: SpBlockPtr): OSErr;
  279.     {$IFC NOT GENERATINGCFM}
  280.     INLINE $205F, $7015, $A06E, $3E80;
  281.     {$ENDC}
  282. FUNCTION SRsrcInfo(spBlkPtr: SpBlockPtr): OSErr;
  283.     {$IFC NOT GENERATINGCFM}
  284.     INLINE $205F, $7016, $A06E, $3E80;
  285.     {$ENDC}
  286. FUNCTION SDisposePtr(spBlkPtr: SpBlockPtr): OSErr;
  287.     {$IFC NOT GENERATINGCFM}
  288.     INLINE $205F, $7017, $A06E, $3E80;
  289.     {$ENDC}
  290. FUNCTION SCkCardStat(spBlkPtr: SpBlockPtr): OSErr;
  291.     {$IFC NOT GENERATINGCFM}
  292.     INLINE $205F, $7018, $A06E, $3E80;
  293.     {$ENDC}
  294. FUNCTION SReadDrvrName(spBlkPtr: SpBlockPtr): OSErr;
  295.     {$IFC NOT GENERATINGCFM}
  296.     INLINE $205F, $7019, $A06E, $3E80;
  297.     {$ENDC}
  298. FUNCTION SFindSRTRec(spBlkPtr: SpBlockPtr): OSErr;
  299.     {$IFC NOT GENERATINGCFM}
  300.     INLINE $205F, $701A, $A06E, $3E80;
  301.     {$ENDC}
  302. FUNCTION SFindDevBase(spBlkPtr: SpBlockPtr): OSErr;
  303.     {$IFC NOT GENERATINGCFM}
  304.     INLINE $205F, $701B, $A06E, $3E80;
  305.     {$ENDC}
  306. FUNCTION SFindBigDevBase(spBlkPtr: SpBlockPtr): OSErr;
  307.     {$IFC NOT GENERATINGCFM}
  308.     INLINE $205F, $701C, $A06E, $3E80;
  309.     {$ENDC}
  310. {  Advanced  }
  311. FUNCTION InitSDeclMgr(spBlkPtr: SpBlockPtr): OSErr;
  312.     {$IFC NOT GENERATINGCFM}
  313.     INLINE $205F, $7020, $A06E, $3E80;
  314.     {$ENDC}
  315. FUNCTION SPrimaryInit(spBlkPtr: SpBlockPtr): OSErr;
  316.     {$IFC NOT GENERATINGCFM}
  317.     INLINE $205F, $7021, $A06E, $3E80;
  318.     {$ENDC}
  319. FUNCTION SCardChanged(spBlkPtr: SpBlockPtr): OSErr;
  320.     {$IFC NOT GENERATINGCFM}
  321.     INLINE $205F, $7022, $A06E, $3E80;
  322.     {$ENDC}
  323. FUNCTION SExec(spBlkPtr: SpBlockPtr): OSErr;
  324.     {$IFC NOT GENERATINGCFM}
  325.     INLINE $205F, $7023, $A06E, $3E80;
  326.     {$ENDC}
  327. FUNCTION SOffsetData(spBlkPtr: SpBlockPtr): OSErr;
  328.     {$IFC NOT GENERATINGCFM}
  329.     INLINE $205F, $7024, $A06E, $3E80;
  330.     {$ENDC}
  331. FUNCTION SInitPRAMRecs(spBlkPtr: SpBlockPtr): OSErr;
  332.     {$IFC NOT GENERATINGCFM}
  333.     INLINE $205F, $7025, $A06E, $3E80;
  334.     {$ENDC}
  335. FUNCTION SReadPBSize(spBlkPtr: SpBlockPtr): OSErr;
  336.     {$IFC NOT GENERATINGCFM}
  337.     INLINE $205F, $7026, $A06E, $3E80;
  338.     {$ENDC}
  339. FUNCTION SCalcStep(spBlkPtr: SpBlockPtr): OSErr;
  340.     {$IFC NOT GENERATINGCFM}
  341.     INLINE $205F, $7028, $A06E, $3E80;
  342.     {$ENDC}
  343. FUNCTION SInitSRsrcTable(spBlkPtr: SpBlockPtr): OSErr;
  344.     {$IFC NOT GENERATINGCFM}
  345.     INLINE $205F, $7029, $A06E, $3E80;
  346.     {$ENDC}
  347. FUNCTION SSearchSRT(spBlkPtr: SpBlockPtr): OSErr;
  348.     {$IFC NOT GENERATINGCFM}
  349.     INLINE $205F, $702A, $A06E, $3E80;
  350.     {$ENDC}
  351. FUNCTION SUpdateSRT(spBlkPtr: SpBlockPtr): OSErr;
  352.     {$IFC NOT GENERATINGCFM}
  353.     INLINE $205F, $702B, $A06E, $3E80;
  354.     {$ENDC}
  355. FUNCTION SCalcSPointer(spBlkPtr: SpBlockPtr): OSErr;
  356.     {$IFC NOT GENERATINGCFM}
  357.     INLINE $205F, $702C, $A06E, $3E80;
  358.     {$ENDC}
  359. FUNCTION SGetDriver(spBlkPtr: SpBlockPtr): OSErr;
  360.     {$IFC NOT GENERATINGCFM}
  361.     INLINE $205F, $702D, $A06E, $3E80;
  362.     {$ENDC}
  363. FUNCTION SPtrToSlot(spBlkPtr: SpBlockPtr): OSErr;
  364.     {$IFC NOT GENERATINGCFM}
  365.     INLINE $205F, $702E, $A06E, $3E80;
  366.     {$ENDC}
  367. FUNCTION SFindSInfoRecPtr(spBlkPtr: SpBlockPtr): OSErr;
  368.     {$IFC NOT GENERATINGCFM}
  369.     INLINE $205F, $702F, $A06E, $3E80;
  370.     {$ENDC}
  371. FUNCTION SFindSRsrcPtr(spBlkPtr: SpBlockPtr): OSErr;
  372.     {$IFC NOT GENERATINGCFM}
  373.     INLINE $205F, $7030, $A06E, $3E80;
  374.     {$ENDC}
  375. FUNCTION SDeleteSRTRec(spBlkPtr: SpBlockPtr): OSErr;
  376.     {$IFC NOT GENERATINGCFM}
  377.     INLINE $205F, $7031, $A06E, $3E80;
  378.     {$ENDC}
  379. FUNCTION OpenSlot(paramBlock: ParmBlkPtr; async: BOOLEAN): OSErr;
  380. FUNCTION OpenSlotSync(paramBlock: ParmBlkPtr): OSErr;
  381.     {$IFC NOT GENERATINGCFM}
  382.     INLINE $205F, $A200, $3E80;
  383.     {$ENDC}
  384. FUNCTION OpenSlotAsync(paramBlock: ParmBlkPtr): OSErr;
  385.     {$IFC NOT GENERATINGCFM}
  386.     INLINE $205F, $A600, $3E80;
  387.     {$ENDC}
  388. {  Device Manager Slot Support  }
  389. FUNCTION SIntInstall(sIntQElemPtr: SQElemPtr; theSlot: INTEGER): OSErr;
  390.     {$IFC NOT GENERATINGCFM}
  391.     INLINE $301F, $205F, $A075, $3E80;
  392.     {$ENDC}
  393. FUNCTION SIntRemove(sIntQElemPtr: SQElemPtr; theSlot: INTEGER): OSErr;
  394.     {$IFC NOT GENERATINGCFM}
  395.     INLINE $301F, $205F, $A076, $3E80;
  396.     {$ENDC}
  397. FUNCTION SVersion(spBlkPtr: SpBlockPtr): OSErr;
  398.     {$IFC NOT GENERATINGCFM}
  399.     INLINE $205F, $7008, $A06E, $3E80;
  400.     {$ENDC}
  401. FUNCTION SetSRsrcState(spBlkPtr: SpBlockPtr): OSErr;
  402.     {$IFC NOT GENERATINGCFM}
  403.     INLINE $205F, $7009, $A06E, $3E80;
  404.     {$ENDC}
  405. FUNCTION InsertSRTRec(spBlkPtr: SpBlockPtr): OSErr;
  406.     {$IFC NOT GENERATINGCFM}
  407.     INLINE $205F, $700A, $A06E, $3E80;
  408.     {$ENDC}
  409. FUNCTION SGetSRsrc(spBlkPtr: SpBlockPtr): OSErr;
  410.     {$IFC NOT GENERATINGCFM}
  411.     INLINE $205F, $700B, $A06E, $3E80;
  412.     {$ENDC}
  413. FUNCTION SGetTypeSRsrc(spBlkPtr: SpBlockPtr): OSErr;
  414.     {$IFC NOT GENERATINGCFM}
  415.     INLINE $205F, $700C, $A06E, $3E80;
  416.     {$ENDC}
  417. FUNCTION SGetSRsrcPtr(spBlkPtr: SpBlockPtr): OSErr;
  418.     {$IFC NOT GENERATINGCFM}
  419.     INLINE $205F, $701D, $A06E, $3E80;
  420.     {$ENDC}
  421.  
  422. {$ALIGN RESET}
  423. {$POP}
  424.  
  425. {$SETC UsingIncludes := SlotsIncludes}
  426.  
  427. {$ENDC} {__SLOTS__}
  428.  
  429. {$IFC NOT UsingIncludes}
  430.  END.
  431. {$ENDC}
  432.